package sis.testio.piped;/*
* @auther 顶风少年 
* @mail dfsn19970313@foxmail.com
* @date 2019-07-29 07:54
* @notify 
* @version 1.0
*/

import java.io.PipedReader;

public class Consumer extends Thread{
    //输入流
    private PipedReader reader = new PipedReader();

    public Consumer(PipedReader reader) {
        this.reader = reader;
    }

    @Override
    public void run() {
        try {
            char [] cbuf = new char[20];
            reader.read(cbuf, 0, cbuf.length);
            System.out.println("管道流中的数据为: " + new String(cbuf));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
